//				UNDEAD PAST: WHAT DRIVES SUPPORT FOR THE SECESSIONIST GOAL OF THE
//						INDIGENOUS PEOPLE OF BIAFRA (IPOB) IN NIGERIA?***
						
//										Daniel Tuki

* This file contains the codes used to estimate the regression models. 

*Survey set command: 
svyset region [pweight=withinwt], vce(linearized) singleunit(missing) || locality, strata(urbrur) || townvill || eaname || respno

*I have also porovided a PDF version of the Afrobarometer survey questionnaire. For all the variables derived from the Afrobarimeter survey dataset, I have specified the relevant question numbers. 


			***DEPENDENT VARIABLE***
*(1) Support secession (secede): Measures support for secession
*(Based on q80b in Afrobarometer questionnaire)
*To treat the "Don't know" and "Refused to answer" responses as missing: 
replace q80b = . if q80b > 5
*To invert the responses so higher values denote higher support for secession: 
gen secede = 6 - q80b


///					EXPLANATORY VARIABLES
			
// (2) Ethnic marginalization (marginalize)
*(Based on q85 in Afrobarometer questionnaire)
destring q85a, generate(marginalize)
*To treat "Don't know" responses as missing:
replace marginalize = . if marginalize > 3

// (3) Democracy (democ): This measures the degree to which the respondents think Nigeria's political system is democratic. 
gen democ = q35
replace democ = . if democ > 4

// (4) Economic deprivation (deprivation)
*(Based on q8a q8b q8c q8d in Afrobarometer questionnaire)

*Food (food)
gen food = q8a
**To treat "Don't know" responses as missing (same for other factors)
replace food = . if food > 4
*Measures the frequency with which the household has gone without food

*Water (water)
gen water = q8b
replace water = . if water > 4
*Measures the frequency with which the household has gone without water for household use

*Medicine (medicine)
gen medicine = q8c
replace medicine = . if medicine > 4
*Measures the frequency with which the household has gone without medicine when sick

*Fuel (fuel)
gen fuel = q8d
replace fuel = . if fuel > 4
*Measures the frequency with which the household has gone without fuel to cook food.

*To sum the four items:  
gen deprivation = food + water + medicine + fuel

*To check the internal reliability of these 4 factors (Cronbbach Alpha 0.78): 
alpha food water medicine fuel

// (5) Literacy rate (lit_both_mean): This measures the literacy rate in the local government area (LGA) where the respondent resides. The statistic was computed using QGIS software since the raw data is gridded. Also, because the data is gendered, I computed the literacy rate for males and females separately, and then took the average. (Based on Worldpop's Development and Health Indicators gridded dataset: https://hub.worldpop.org/geodata/listing?id=23)

*To express literacy rate in percetage (i.e., the average of both males and females)
gen percent_lit_both_mean = lit_both_mean * 100


///					CONTROL VARIABLES
			
// (6) Political stability (acled_vio_incids_96_16): This measures the cumulative number of violent conflicts incidents in the LGA where the respondent resides from 1997 to 2016. I define a violent conflict as any incident that falls under any of the following three categories: "Battles", "Explosions/Remote violence", "Violence against civilians." This relevant statistic was computed using QGIS software. (Based on ACLED data: https://acleddata.com/). 
			
// (7) Age (age): 
*(Based on q1 in Afrobarometer questionnaire)
gen age = q1
*To treat the "don't know" response as missing "i.e., value of 998"
replace age = . if age == 998

// (8) Gender (gender): Dummy variable indicating the gender of the respondent
*(Based on q101 in Afrobarometer questionnaire)
*In q101, male = 1, and female = 2. 
*To make this a dummy variable with Male = 1, and female = 0
gen gender = q101
replace gender = 0 if gender == 2


//				VARIABLES IDENTIFYING THE DISTINCT ETHNIC CATEGORIES
			
// ETHNIC GROUPS*
*(Based on q84 in Afrobarometer questionnaire)
*To create dummy variables for the ethnic categories in Nigeria: 

// (9) Igbo (igbo)
gen igbo = 0
replace igbo = 1 if q84 == 621
*To account for the Igbo respondent listed under "q84other" as "IBO"
replace igbo = 1 if (q84other == "IBO")
replace igbo = . if q84 == . 
*To treat the one respondet who sees self only as Nigeria as missing: 
replace igbo = . if q84 == 9990

// (10) Hausa/Fulani (hausa_fulani)
gen hausa_fulani = 0
*To treat the one respondet who sees self only as Nigeria as missing: 
replace hausa_fulani = . if q84 == 9990
*To account for the Hausa:
replace hausa_fulani = 1 if q84 == 620
*To account for the Fulani: 
replace hausa_fulani = 1 if q84 == 625
*To account for the 1 "Fulani" respondent listed in q84other
replace hausa_fulani = 1 if (q84other == "FULANI")
replace hausa_fulani = . if q84 == . 

// (11) Yoruba (yoruba):
gen yoruba = 0 
replace yoruba = 1 if q84 == 622
*To treat the one respondent who sees self only as Nigeria as missing: 
replace yoruba = . if q84 == 9990
replace yoruba = . if q84 == . 

// (12) Other ethnic groups besides the major three (ethnic_others)
gen other_ethnic = 1
*To treat the one respondet who sees self only as Nigeria as missing: 
replace other_ethnic = . if q84 == 9990
*To code members of the 3 major ethnic groups as 0:
replace other_ethnic = 0 if hausa_fulani == 1
replace other_ethnic = 0 if yoruba == 1
replace other_ethnic = 0 if igbo == 1
replace other_ethnic = . if q84 == . 



///						REGRESSION MODELS

//	Table 1: Correlates of support for secession among Igbos

*Model 1: Ethnic marginalization - baseline
ologit secede marginalize, vce(cluster district), if igbo == 1
*To obtain the AIC statistics
estat ic

*Model 2: Democracy - baseline 
ologit secede democ, vce(cluster district), if igbo == 1
*To obtain the AIC statistics
estat ic

*Model 3: Soioeconomic condition - household - baseline 
ologit secede deprivation, vce(cluster district), if igbo == 1
*To obtain the AIC statistics
estat ic

*Model 4: Soioeconomic condition - communnal - baseline 
ologit secede percent_lit_both_mean, vce(cluster district), if igbo == 1
*To obtain the AIC statistics
estat ic

*Model 5 - Adding all explanatory variables:
ologit secede marginalize democ deprivation percent_lit_both_mean, vce(cluster district), if igbo == 1
*To obtain the AIC statistics
estat ic

*Model 6 - Adding all explanatory & control variables:
ologit secede marginalize democ deprivation percent_lit_both_mean acled_vio_incids_96_16 age gender, vce(cluster district), if igbo == 1
*To obtain the AIC statistics
estat ic


//	Table 2: Correlates of support for secession among the major ethnic categories

*Model 1: Igbo
ologit secede igbo, vce(cluster district)
*To obtain the AIC statistics
estat ic

*Model 2: Yoruba
ologit secede yoruba, vce(cluster district)
*To obtain the AIC statistics
estat ic

*Model 3: Hausa/Fulani
ologit secede hausa_fulani, vce(cluster district)
*To obtain the AIC statistics
estat ic

*Model 4: Ethnic minorities
ologit secede other_ethnic, vce(cluster district)
*To obtain the AIC statistics
estat ic

*Model 5: Three major ethnic groups combined (Ethnic minorities as reference category)
ologit secede igbo yoruba hausa_fulani, vce(cluster district)
*To obtain the AIC statistics
estat ic
		

		
//			CODES USED TO DEVELOP THE GRAPHS (Figures 8 & 9)

*Figure 8: Average marginal effects of the explanatory variables on support for secession

*Panel A: Perceived ethnic marginalization
ologit secede marginalize, vce(cluster district), if igbo == 1
*To obtain the marginal effects
margins, dydx(*)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (marginalize, replace)

*Panel B: Democracy  
ologit secede democ, vce(cluster district), if igbo == 1
*To obtain the marginal effects
margins, dydx(*)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (democ, replace)

*Panel C: Deprivation index 
ologit secede deprivation, vce(cluster district), if igbo == 1
*To obtain the marginal effects
margins, dydx(*)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (deprive, replace)

*Panel D: Literacy rate 
ologit secede percent_lit_both_mean, vce(cluster district), if igbo == 1
*To obtain the marginal effects
margins, dydx(*)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (literacy, replace)

*To combine all the graphs:
graph combine marginalize democ deprive literacy



*Figure 9: Average marginal effects of ethnicity on support for secession

*Panel 1: Igbo
ologit secede igbo, vce(cluster district)
*To obtain the marginal effects
margins, dydx(*)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (igbo, replace)

*Panel 2: Yoruba
ologit secede yoruba, vce(cluster district)
*To obtain the marginal effects
margins, dydx(*)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (yoruba, replace)

*Panel 3: Hausa/Fulani
ologit secede hausa_fulani, vce(cluster district)
*To obtain the marginal effects
margins, dydx(*)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (hausa_fulani, replace)

*Panel 4: Ethnic minorities
ologit secede other_ethnic, vce(cluster district)
*To obtain the marginal effects
margins, dydx(*)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (minorities, replace)

*To cobine all the graphs:
graph combine igbo yoruba hausa_fulani minorities



///						APPENDIX

//	Table A1: Descriptive statistics (Full sample/Igbo subsammple)

*Full sample
summ secede marginalize igbo hausa_fulani yoruba other_ethnic democ deprivation percent_lit_both_mean acled_vio_incids_96_16 age gender

*Igbo subsample
summ (secede marginalize democ deprivation percent_lit_both_mean acled_vio_incids_96_16 age gender) if igbo == 1



//	Table A2: Correlation between the variables (Igbo subsample)
corr (secede marginalize democ deprivation percent_lit_both_mean acled_vio_incids_96_16 age gender) if igbo == 1



//	Table A3: Correlation between the variables (Full sample)
corr secede marginalize igbo hausa_fulani yoruba other_ethnic democ deprivation percent_lit_both_mean acled_vio_incids_96_16 age gender



//	Table A4: Ethnic distribution of respondents  
tab q84
*See the respective ethnicities associated with the numeric codes in q84 in the Afrobarometer questionnaire. 



//	Table A5: Correlates of support for secession among non-Igbos

*Model 1: Ethnic marginalization - baseline
ologit secede marginalize, vce(cluster district), if igbo == 0 
*To obtain the AIC statistics
estat ic

*Model 2: Democracy - baseline 
ologit secede democ, vce(cluster district), if igbo == 0 
*To obtain the AIC statistics
estat ic

*Model 3: Soioeconomic condition - household - baseline 
ologit secede deprivation, vce(cluster district), if igbo == 0 
*To obtain the AIC statistics
estat ic

*Model 4: Soioeconomic condition - communnal - baseline 
ologit secede percent_lit_both_mean, vce(cluster district), if igbo == 0 
*To obtain the AIC statistics
estat ic

*Model 5 - Adding all explanatory variables:
ologit secede marginalize democ deprivation percent_lit_both_mean, vce(cluster district), if igbo == 0 
*To obtain the AIC statistics
estat ic

*Model 6 - Adding all explanatory & control variables:
ologit secede marginalize democ deprivation percent_lit_both_mean acled_vio_incids_96_16 age gender, vce(cluster district), if igbo == 0 
*To obtain the AIC statistics
estat ic
		
		
		
//			CODES USED TO DEVELOP GRAPHS (Figure A1)

*Figure 8: Average marginal effects of the explanatory variables on support for secession

*Panel A: Perceived ethnic marginalization
ologit secede marginalize, vce(cluster district), if igbo == 0
*To obtain the marginal effects
margins, dydx(*)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (marginalize, replace)

*Panel B: Democracy  
ologit secede democ, vce(cluster district), if igbo == 0
*To obtain the marginal effects
margins, dydx(*)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (democ, replace)

*Panel C: Deprivation index 
ologit secede deprivation, vce(cluster district), if igbo == 0
*To obtain the marginal effects
margins, dydx(*)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (deprive, replace)

*Panel D: Literacy rate 
ologit secede percent_lit_both_mean, vce(cluster district), if igbo == 0
*To obtain the marginal effects
margins, dydx(*)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (literacy, replace)

*To combine all the graphs:
graph combine marginalize democ deprive literacy

		
		
		
		
		
		
		
		